{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Translation skill"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>text</th>\n",
       "      <th>language</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>El sol brilla siempre</td>\n",
       "      <td>Spanish</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>La vie est belle</td>\n",
       "      <td>French</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Der Wald ruft mich</td>\n",
       "      <td>German</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Amo la pizza napoletana</td>\n",
       "      <td>Italian</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>春天的花很美</td>\n",
       "      <td>Chinese</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Звезды сверкают ночью</td>\n",
       "      <td>Russian</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>雨の後の虹</td>\n",
       "      <td>Japanese</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>커피가 필요해</td>\n",
       "      <td>Korean</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>A música toca a alma</td>\n",
       "      <td>Portuguese</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>सपने सच होते हैं</td>\n",
       "      <td>Hindi</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      text    language\n",
       "0    El sol brilla siempre     Spanish\n",
       "1         La vie est belle      French\n",
       "2       Der Wald ruft mich      German\n",
       "3  Amo la pizza napoletana     Italian\n",
       "4                   春天的花很美     Chinese\n",
       "5    Звезды сверкают ночью     Russian\n",
       "6                    雨の後の虹    Japanese\n",
       "7                  커피가 필요해      Korean\n",
       "8     A música toca a alma  Portuguese\n",
       "9         सपने सच होते हैं       Hindi"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "df = pd.DataFrame([\n",
    "    {\"text\": \"El sol brilla siempre\", \"language\": \"Spanish\"},\n",
    "    {\"text\": \"La vie est belle\", \"language\": \"French\"},          \n",
    "    {\"text\": \"Der Wald ruft mich\", \"language\": \"German\"},\n",
    "    {\"text\": \"Amo la pizza napoletana\", \"language\": \"Italian\"},\n",
    "    {\"text\": \"春天的花很美\", \"language\": \"Chinese\"},       \n",
    "    {\"text\": \"Звезды сверкают ночью\", \"language\": \"Russian\"},\n",
    "    {\"text\": \"雨の後の虹\", \"language\": \"Japanese\"},\n",
    "    {\"text\": \"커피가 필요해\", \"language\": \"Korean\"},\n",
    "    {\"text\": \"A música toca a alma\", \"language\": \"Portuguese\"},\n",
    "    {\"text\": \"सपने सच होते हैं\", \"language\": \"Hindi\"}\n",
    "])\n",
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Applying skill: translation\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Applying skill: translation\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█| 10/10 [00:00<00:00\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>text</th>\n",
       "      <th>language</th>\n",
       "      <th>translation</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>El sol brilla siempre</td>\n",
       "      <td>Spanish</td>\n",
       "      <td>Jua linang'aa daima</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>La vie est belle</td>\n",
       "      <td>French</td>\n",
       "      <td>Maisha ni mazuri</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Der Wald ruft mich</td>\n",
       "      <td>German</td>\n",
       "      <td>Msitu unaniita</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Amo la pizza napoletana</td>\n",
       "      <td>Italian</td>\n",
       "      <td>Napenda pizza ya Napoli</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>春天的花很美</td>\n",
       "      <td>Chinese</td>\n",
       "      <td>Maua ya msimu wa kuchipua ni mazuri sana.</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Звезды сверкают ночью</td>\n",
       "      <td>Russian</td>\n",
       "      <td>Nyota zinang'aa usiku</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>雨の後の虹</td>\n",
       "      <td>Japanese</td>\n",
       "      <td>Mvua wa mvua</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>커피가 필요해</td>\n",
       "      <td>Korean</td>\n",
       "      <td>Ninahitaji kahawa</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>A música toca a alma</td>\n",
       "      <td>Portuguese</td>\n",
       "      <td>Muziki unagusa roho</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>सपने सच होते हैं</td>\n",
       "      <td>Hindi</td>\n",
       "      <td>Ndoto zinatimia</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                      text    language  \\\n",
       "0    El sol brilla siempre     Spanish   \n",
       "1         La vie est belle      French   \n",
       "2       Der Wald ruft mich      German   \n",
       "3  Amo la pizza napoletana     Italian   \n",
       "4                   春天的花很美     Chinese   \n",
       "5    Звезды сверкают ночью     Russian   \n",
       "6                    雨の後の虹    Japanese   \n",
       "7                  커피가 필요해      Korean   \n",
       "8     A música toca a alma  Portuguese   \n",
       "9         सपने सच होते हैं       Hindi   \n",
       "\n",
       "                                 translation  \n",
       "0                        Jua linang'aa daima  \n",
       "1                           Maisha ni mazuri  \n",
       "2                             Msitu unaniita  \n",
       "3                    Napenda pizza ya Napoli  \n",
       "4  Maua ya msimu wa kuchipua ni mazuri sana.  \n",
       "5                      Nyota zinang'aa usiku  \n",
       "6                               Mvua wa mvua  \n",
       "7                          Ninahitaji kahawa  \n",
       "8                        Muziki unagusa roho  \n",
       "9                            Ndoto zinatimia  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from adala.agents import Agent\n",
    "from adala.environments import StaticEnvironment\n",
    "from adala.skills.collection.translation import TranslationSkill\n",
    "from rich import print\n",
    "\n",
    "agent = Agent(skills=TranslationSkill(target_language='Swahili'))\n",
    "\n",
    "agent.run(df)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "adala",
   "language": "python",
   "name": "adala"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
